<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>2409281</title>
    <script>
        console.log("数据类型：")
        let str = 'hello world';
        console.log(str+':',typeof str);
        let num = 123;
        console.log(num+':',typeof num);
        let bool = true;
        console.log(bool+':',typeof bool);
        let undef;
        console.log(undef+':',typeof undef);
        let nul = null;
        console.log(nul+':',typeof nul);
        let obj = {'1':1,'2':2};
        console.log(obj+':',typeof obj);
        let arr = [1,2];
        console.log(arr+':',typeof arr);
        // let sym = Symbol();
        // console.log(sym+':',typeof sym);
        let big = 123456789012345678901234567890n;
        console.log(big+':',typeof big);
        let func = function(){}
        console.log(func+':',typeof func);
        let reg = /\d+/;
        console.log(reg+':',typeof reg);
        let date = new Date();
        console.log(date+':',typeof date);
        let set = new Set();
        console.log(set+':',typeof set);
        let map = new Map();
        console.log(map+':',typeof map);
        let weak = new WeakSet();
        console.log(weak+':',typeof weak);
        let weakMap = new WeakMap();
        console.log(weakMap+':',typeof weakMap);
        let a=12,b=3;
        console.log("算数运算符：")
        console.log("a="+a, "b="+b)
        console.log("a+b="+(a+b));
        console.log("a-b="+(a-b));
        console.log("a*b="+(a*b));
        console.log("a/b="+(a/b));
        console.log("a%b="+(a%b));
        console.log("a**b="+(a**b));
        console.log("a++="+(a++));
        console.log("++a="+(++a));
        console.log("a--="+(a--));
        console.log("--a="+(--a));
        console.log("位运算符：")
        console.log("a="+a, "b="+b);
        console.log("a&b=",(a&b));
        console.log("a|b=",(a|b));
        console.log("a^b=",(a^b));
        console.log("a<<b=",(a<<b));
        console.log("a>>b=",(a>>b));
        console.log("a>>>b=",(a>>>b));
        console.log("逻辑运算符：")
        console.log("a="+a, "b="+b);
        console.log("a&&b=",(a&&b));
        console.log("a||b=",(a||b));
        console.log("!a=",(!a));
        console.log("a==b=",(a==b));
        console.log("a!=b=",(a!=b));
        console.log("a===b=",(a===b));
        console.log("a!==b=",(a!==b));
        for(let i=0;i<5;i++) console.log(i);
        if(a>b) console.log("a>b");
        else if (a<b) console.log("a<b");
        else console.log("a==b");
        function f(){console.log("f()");}
        let fun= function(a,b){return a===0 ? b : fun(b%a,a);}
        console.log("最大公约数："+fun(12,18));
        (function (){console.log("自运行函数")})()
    </script>
</head>
<body>
<button onclick="f()">点击</button>
<button id="but">点击</button>
<script>
    let but = document.getElementById("but");
    but.onclick = function () {console.log("点击了按钮");}
</script>
</body>
</html>